using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class TabInvites
    {   
		public Text InviteCode;
		public CButton BtnCopyCode;
		public Text InviteDesc;
		public CButton BtnCopyLink;
		public Text MyInviteCount;
		public CButton BtnRule;
		public CButton BtnTG;
		public CButton BtnTW;
		public CButton BtnFB;
		public Image Ad;
		public Text CountsText1;
		public Text CountsText2;
		public Text CountsText3;
		public Text CountsText4;
		public Text CountsText5;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			InviteCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnCopyCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InviteDesc = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnCopyLink = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			MyInviteCount = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnRule = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnTG = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnTW = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnFB = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Ad = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			CountsText1 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			CountsText2 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			CountsText3 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			CountsText4 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			CountsText5 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_my_invite_code { get { return i18n.GetTextByKey("my_invite_code"); } }
		public string I18N_share_desc { get { return i18n.GetTextByKey("share_desc"); } }
		public string I18N_my_invite_count { get { return i18n.GetTextByKey("my_invite_count"); } }
		public string I18N_content_is_copied { get { return i18n.GetTextByKey("content_is_copied"); } }
    }
}
